package com.oren.json;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

public class JSONParser  {
	public static JSON parse(InputStream is) {
		return null;
	}
	public static JSON parse(URL url) throws IOException {
		return parse(url.openStream());
	}
	public static JSON parse(String fullstr) {
		JSON json = new JSON();
		int[] off = new int[1];
		for(off[0] = 0;off[0] < fullstr.length();) {
			if(off[0] >= fullstr.length()) break;
			char c = fullstr.charAt(off[0]++);
			if(c == '{') {
				json = gObj(fullstr, off);
			} else {
				continue;
			}
		}
		return json;
	}
	
	private static JSON gObj(String fullstr, int[] off) {
		JSON json = new JSON();
		return json;
	}
	
	// 시작문자(' or ")를 만났을때  끝나는 (' or ")를 만날때까지의 스트링을 가져온다.
	private static String gStr(String str, char ch, int[] off) {
		StringBuffer ret = new StringBuffer();
		for(int i = off[0];i < str.length();i++) {
			char c = str.charAt(i);
			if(c != ch) {
				ret.append(c);
			} else {
				off[0] = i;
				break;
			}
		}
		
		return ret.toString();
	}
}
